import request from '@/utils/request'


// 查询商品信息列表
export function listInfopi(query) {
  return request({
    url: '/shopping/goods/listpi',
    method: 'get',
    params: query
  })
}

// 查询商品信息详细
export function getInfopi(productId) {
  return request({
    url: '/shopping/goods/' + productId,
    method: 'get'
  })
}

// 新增商品信息
export function addInfopi(data) {
  return request({
    url: '/shopping/goods',
    method: 'post',
    data: data
  })
}

// 修改商品信息
export function updateInfopi(data) {
  return request({
    url: '/shopping/goods',
    method: 'put',
    data: data
  })
}

// 删除商品信息
export function delInfopi(productId) {
  return request({
    url: '/shopping/goods/' + productId,
    method: 'delete'
  })
}

// 导出商品信息
export function exportInfopi(query) {
  return request({
    url: '/shopping/goods/exportpi',
    method: 'get',
    params: query
  })
}

export function publishStatusUpdate(productId, publishStatus) {
  const data = {
    productId,
    publishStatus
  }
  return request({
    url: '/shopping/goods/publishStatus',
    method: 'put',
    data: data
  })
}

export function auditStatusUpdate(productId, auditStatus) {
  const data = {
    productId,
    auditStatus
  }
  return request({
    url: '/shopping/goods/auditStatus',
    method: 'put',
    data: data
  })
}
